#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  struct store {
   int score;
   string name;
  };
  vector<store> arr(n);
  for(auto &[score,name]:arr) cin>>score>>name;
  sort(arr.begin(),arr.end(),[](store &a,store &b){
    return a.score>b.score;
  });
  cout<<arr[0].name;
}